package algorithm.poj.p1000;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLDecoder;


/**
 * 分析：
 * 这个问题很简单，可以遍历一次加密后的字符串就可以判断。
 * 
 * 实现：
 * 
 * 经验和教训：
 * 
 * 
 * @author wong.tong@gmail.com
 *
 */
public class P1936 {

	public static void main(String[] args) throws Exception {

		InputStream input = null;
		if (false) {
			input = System.in;
		} else {
			URL url = P1936.class.getResource("P1936.txt");
			File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
			input = new FileInputStream(file);
		}
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(input));

		String line = stdin.readLine();
		while (line != null) {
			String[] tmp = line.trim().split("\\s+");
			System.out.println(check(tmp[0].toCharArray(), tmp[1].toCharArray())?"Yes":"No");
			line = stdin.readLine();
		}
	}

	private static boolean check(char[] s, char[] t) {

		//查找过程无需回溯
		int i = 0;
		int j = 0;
		for (; i < s.length;) {
			for (;j < t.length;) {
				if (t[j] == s[i]) {
					i ++;
					j ++;
					break;
				} else {
					j ++;
				}
			}
			if (j == t.length) {
				break;
			}
		}
		
		return i == s.length;
	}
}